package com.single.weblearn.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.single.weblearn.dao.ProductDao;
import com.single.weblearn.meta.Product;
@Controller
public class IndexController {
	@Autowired
	private  ProductDao dao;
	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String index(ModelMap map){
		List<Product> productList = dao.getProductList();
		map.addAttribute("productList", productList);
		return "index";
	}
}
